package com.ruoyi.h5.user.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.h5.user.controller.pojo.dto.BindAccountLoginDTO;
import com.ruoyi.h5.user.controller.pojo.dto.LoginWithAuthCodeDTO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户登录方式信息Controller
 *
 * @author ccc
 * @date 2025-02-25
 */
@RestController
@RequestMapping("h5/user/login")
public class UserLoginMethodsController extends BaseController
{

    /**
     * 三方账号授权登陆
     */
    @PostMapping("/loginWithAuthCode")
    public AjaxResult loginWithAuthCode(@Validated @RequestBody LoginWithAuthCodeDTO loginWithAuthCodeDTO)
    {
        // 根据code值获取用户unionId

        // 根据unionId查询是否绑定账号

        // 若已绑定返回其登陆信息
        return success();
    }

    /**
     * 三方账号绑定并登陆
     */
    @PostMapping("/bindAccountLogin")
    public AjaxResult bindAccountLogin(@Validated @RequestBody BindAccountLoginDTO bindAccountLoginDTO)
    {
        // 验证账号密码验证码是否正确

        // 执行绑定

        // 返回登陆信息
        return success();
    }

}
